﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyEmployees.DAL;
using MyEmployees.Models;

namespace MyEmployees.BLL
{
    public class EmployeeManage
    {
        EmployeeService empService = new EmployeeService();
        
        //获取雇员列表
        public IList<Employees> GetEmployeesList() 
        {
            return empService.GetEmployeesList();
        }


        private bool Exist(int employeeID)
        {
            return empService.Exist(employeeID);
        }


        //删除雇员
        public int DeleteEmployee(int employeeID)
        {
            if (Exist(employeeID))
                return -1;
            else
                return empService.DeleteEmployee(employeeID);
        }


        //根据ID值查找雇员
        public Employees SearchById(int employeeID)
        {
            return empService.SearchById(employeeID);
        }

        //保存对雇员的修改
        public bool SaveEdit(Employees emp)
        {
            return empService.SaveEdit(emp);
        }


        //根据表中的ID取值自动生成新Id
        public int GetId()
        {
            return empService.GetId();
        }

        //保存新员工信息
        public bool SaveAdd(Employees newemp)
        {
            return empService.SaveAdd(newemp);       
            
        }
    }
}
